/*
Stringlist Library v0.1.a
Copyright (c) 2011, Sulaiman A. Mustafa
All rights reserved.

   Redistribution and use in source and binary forms, with or without 
   modification, are permitted provided that the following conditions 
   are met:

     Redistributions of source code must retain the above copyright 
     notice, this list of conditions and the following disclaimer.
     
     Redistributions in binary form must reproduce the above 
     copyright notice, this list of conditions and the following 
     disclaimer in the documentation and/or other materials provided 
     with the distribution.

   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

*/
#ifndef ___SLLIB
#include <stdio.h>
#include <stdlib.h>

struct stringlist{
	char **list;
	int count;
};

char *initialize_string(const char* string);
void initialize_stringlist(struct stringlist *list);
void add_string_to_stringlist(struct stringlist *list, char *string);
void add_sllib_string_to_stringlist(struct stringlist *list, char *string);
void free_stringlist(struct stringlist *list);
void print_stringlist(struct stringlist *list);
char* get_next_string_from_stringlist(struct stringlist *list, int reset);
char *append_string(char *dest, const char *src);
char *replace_char_with_string(char *dest, char which, char *what);
char* free_string(char *string);


#define SLLIB_STRETCH_STRING_MACRO(STRING, SIZE)\
	if(!((STRING)=(char *)realloc((STRING), sizeof(char)*(SIZE)))){\
		fprintf(stderr, "append_string: Out of memory!");\
		exit(1);\
	}
	
#define ___SLLIB
#endif
